package org.catspaw.cherubim.persistence.spring.jdbc;

import java.sql.PreparedStatement;
import java.sql.SQLException;

import org.catspaw.cherubim.persistence.jdbc.SuitableParameterUtils;
import org.springframework.jdbc.core.PreparedStatementSetter;

public class SuitableParameterPreparedStatementSetter implements
		PreparedStatementSetter {

	private Object[] params;

	public SuitableParameterPreparedStatementSetter(Object[] params) {
		this.params = params;
	}

	public void setValues(PreparedStatement ps) throws SQLException {
		for (int i = 0; i < params.length; i++) {
			SuitableParameterUtils.setSuitedParameter(ps, i + 1, params[i]);
		}
	}
}
